package com.Merlin.myapplication

import android.os.Bundle
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat

class PageTwoActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        enableEdgeToEdge()
        setContentView(R.layout.activity_page_two)
        // 1. 接受上一个页面传递的参数
        val name = intent.getStringExtra("name")
        val age = intent.getIntExtra("age", 0)
        val height = intent.getFloatExtra("height", 0f)

        // 2. 在页面中显示参数
        findViewById<android.widget.TextView>(R.id.tv_title).text =
            "姓名: $name, 年龄: $age, 身高: $height"

        // 3. 点击返回
        findViewById<android.widget.Button>(R.id.btn_back).setOnClickListener {
            finish()
        }
    }
}